import request from '@/utils/request';

// 查询组织架构树
export function getOrgTree(param) {
	return request({
		url: '/oa/oa/org/tree',
		method: 'get',
		params: param,
	});
}

export function getUserSign() {
	return request({
		url: '/oa/oa/org/user/sign',
		method: 'get',
	});
}

// 查询系统角色
export function getRole() {
	return request({
		url: '/oa/oa/org/role',
		method: 'get',
	});
}

// 搜索人员
export function getUserByName(param) {
	return request({
		url: '/oa/oa/org/tree/user/search',
		method: 'get',
		params: param,
	});
}

// 搜索人员
export function getUserDepts(userId) {
	return request({
		url: `/oa/oa/org/user/${userId}/dept`,
		method: 'get',
	});
}

// 获取审批代理人
export function getUserAgent() {
	return request({
		url: `/oa/oa/org/user/agent`,
		method: 'get',
	});
}

// 获取审批代理人
export function setUserAgent(params) {
	return request({
		url: `/oa/oa/org/user/agent`,
		method: 'put',
		data: params,
	});
}

// 获取审批代理人
export function cancelUserAgent() {
	return request({
		url: `/oa/oa/org/user/agent`,
		method: 'delete',
	});
}

export default {
	getUserSign,
	getOrgTree,
	getUserByName,
	getRole,
	getUserDepts,
	getUserAgent,
	setUserAgent,
	cancelUserAgent,
};
